{% extends "v2ex/_base.html" %}
{% block title %}{{ data.title }}{% endblock %}
{% block rightbar %}{% endblock %}
{% block body %}
<div class="sep20"></div>
<div class="box">
    <div class="header" >
        <a href="#">SJZLUG</a>
        <span class="chevron"><span class="chevron">&nbsp;›&nbsp;</span>注册</span>
    </div>
    <div class="inner">
        <form  method="post" id = "signupform" class="form-horizontal" role="form">
            {{data.form.hidden_tag()}}
            <div style="height:10px;"></div>
            <span class="fade" style="color:#f00;">
            {% for message in get_flashed_messages() %}{{ message }}{% endfor %}
            </span>
            <div class="form-group" style="height:34px;">
                <label for="name" class="col-sm-2 control-label">用户名</label>
                <div class="col-sm-10">
                    {{ data.form.name(placeholder="用户名",class="form-control",style="width:40%;") }}
                    {% for error in data.form.name.errors %} {{ error }} {% endfor %}
                    <span class="fade">请使用半角的 a-z 或数字 0-9</span>
                </div>
            </div>
            <div class="form-group">
                <label for="nick" class="col-sm-2 control-label">呢称</label>
                <div class="col-sm-10">
                    {{ data.form.nick(placeholder="呢称",class="form-control",style="width:40%;") }}
                    {% for error in data.form.nick.errors %} {{ error }} {% endfor %}
                    <span class="fade">你可以给自已一个霸气范的名字，彰显你独一无二的个性</span>
                </div>
            </div>
            <div class="form-group">
                <label for="pwd" class="col-sm-2 control-label">密码</label>
                <div class="col-sm-10">
                    {{ data.form.pwd(placeholder="密码",class="form-control",style="width:40%;") }}
                    {% for error in data.form.pwd.errors %} {{ error }} {% endfor %}
                </div>
            </div>
            <div class="form-group">
                <label for="pwd2" class="col-sm-2 control-label " >重复密码</label>
                <div class="col-sm-10">
                    {{ data.form.pwd2(placeholder="重复密码",class="form-control",style="width:40%;") }}
                    {% for error in data.form.pwd2.errors %} {{ error }} {% endfor %}
                    <span class="fade">撞库猖獗，还是设置的复杂一点吧，尽量别用一样的密码</span>
                </div>
            </div>
            <div class="form-group">
                <label for="qq" class="col-sm-2 control-label " >QQ</label>
                <div class="col-sm-10">
                    {{ data.form.qq(placeholder="QQ",class="form-control",style="width:40%;") }}
                    {% for error in data.form.qq.errors %} {{ error }} {% endfor %}
                </div>
            </div>
            <div class="form-group">
                <label for="phone" class="col-sm-2 control-label ">手机号码</label>
                <div class="col-sm-10">
                    {{ data.form.phone(placeholder="手机号码",class="form-control",style="width:40%;") }}
                    {% for error in data.form.phone.errors %} {{ error }} {% endfor %}
                </div>
            </div>
            <div class="form-group">
                <label for="mail" class="col-sm-2 control-label ">电子邮件</label>
                <div class="col-sm-10">
                    {{ data.form.mail(placeholder="电子邮件",class="form-control",style="width:40%;") }}
                    {% for error in data.form.mail.errors %} {{ error }} {% endfor %}
                    <span class="fade">QQ,手机号,邮箱写真实的吧，我们不会将你的联系方式分享给任何人</span>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2"></label>
                <div class="col-sm-10">
                    <input type="button" id="btn_signup" class="super normal button" value="注册">
                </div>
            </div>
        </form>
    </div>
</div>
<div class="sep20"></div>
<script src="/static/v2ex/js/md5.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $('#btn_signup').click(function(){
        $("#btn_signup").attr('disabled',true);
        var form= document.getElementById("signupform");
        if (form){
            form.pwd.value = md5(form.pwd.value);
            form.pwd2.value = md5(form.pwd2.value);
            form.action="{{ url_for('main.signup') }}";
            form.submit();
        }
        $("#btn_signup").attr('disabled',false);
    });
});
</script>
{% endblock %}
